package com.ibiaoke.boss.controller;

import com.ibiaoke.common.base.BaseController;
import com.ibiaoke.common.base.Page;
import com.ibiaoke.common.response.Res;
import com.ibiaoke.customer.entity.Deposit;
import com.ibiaoke.customer.service.DepositService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.math.BigDecimal;
import java.util.List;

/**
 * Created by Administrator on 2017/6/19.
 */
@Controller
public class DepositController extends BaseController {

    @Autowired
    private DepositService depositService;

    /**
     * 客户与存款查询
     * @param customerMobile
     * @param page
     * @return
     */
    @ResponseBody
    @RequestMapping("/listDeposit")
    public Res listDeposit(String customerMobile,Page page){
        List<Deposit> depositList = depositService.listDeposit(customerMobile,page);
        return Res.create().addResponse("depositList", depositList).addResponse("page", page);
    }

    @ResponseBody
    @RequestMapping("/updateDeposit")
    public Res updateDeposit(String customerMobile, BigDecimal money, Integer type){
        Integer count = depositService.updateDeposit(customerMobile, money, type);
        return Res.create();
    }
}
